#pragma once

#include <core/defines.hpp>
#include <app/keycodes.hpp>

#include <glm/glm.hpp>

namespace core::app {
    class WindowCallbacks;
}

namespace core::input {

    class InputContext {
        friend class app::WindowCallbacks;

    public:
        InputContext();

        ~InputContext();

        void Init(void *win);

        void Reset();

        [[nodiscard]] b8 IsKeyPressed(key_code key) const;

        [[nodiscard]] b8 IsMousePressed(mouse_button button) const;

        [[nodiscard]] glm::vec2 GetMousePos() const;

    private:
        b8        resized;
        b8        key_state[(u16)key_code::Last + 1];
        b8        mouse_button_state[(u16)mouse_button::ButtonMax + 1];
        glm::vec2 wheel;
        void     *window {};
    };

}  // namespace core::input
